require 'filters'

class Main
  
  include Filters
  
  def initialize(*proc_array)
    @proc = And.new(*proc_array)
  end
  
  def process(combinations)
    combinations.each{|combination|
      yield combination if @proc.call(combination)
    }
  end
  
end

class Main2
  
  include Filters
  
  def initialize(*proc_array)
    @proc = And.new(*proc_array)
  end
  
  def process(combination)
    yield combination if @proc.call(combination)
  end
  
end

class Main3
  
  include Filters
  
  def initialize(*proc_array)
    @proc = And.new(*proc_array)
  end
  
  def process(combinations)
    combinations.select{|combination| @proc.call(combination) }
  end
  
end

#require "test/unit"
#
#class MainTest < Test::Unit::TestCase
#  
#  include Filters
#  
#  def test_should_call_all_filters
#    Main.new(not_(all_even()), not_(all_odd()), SumRange.new((68..148))).process((1..30).to_a.combination(7)){ |combination| print combination }
#  end
#  
#  def test_should_call_all_filters3
#    print "\n"
#    filters = Main2.new(not_(all_even()), not_(all_odd()))
#     (1..29).to_a.combination(7){|combination|
#      filters.process(combination){ |combination| print combination }
#    }
#  end
#end

